<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form [formGroup]="majorForm" (keydown.enter)="$event.preventDefault()">
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="facultyName" nzRequired>院系名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择院系名称'">
              <nz-input-group nzSearch [nzAddOnAfter]="suffixIconButton">
                <input nz-input formControlName="facultyName" placeholder="请选择院系名称" readonly />
              </nz-input-group>
              <ng-template #suffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findFaculty()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="name" nzRequired>专业名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入专业名称'">
              <input nz-input formControlName="name" placeholder="请输入专业名称" maxlength="64"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="degreeType" nzRequired>学位类型</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择学位类型'">
              <nz-select formControlName="degreeType">
                <nz-option nzLabel="学士" [nzValue]="1"></nz-option>
                <nz-option nzLabel="硕士" [nzValue]="2"></nz-option>
                <nz-option nzLabel="博士" [nzValue]="3"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="duration" nzRequired>学制(年)</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择学制(年)'">
            <nz-input-number formControlName="duration" nzMin="1" nzMax="99" />
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="contactPhone" nzRequired>联系电话</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入联系电话'">
              <input nz-input formControlName="contactPhone" placeholder="请输入联系电话" maxlength="64"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="email" nzRequired>邮箱</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入邮箱'">
              <input nz-input formControlName="email" placeholder="请输入邮箱" maxlength="64"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="officeLocation" nzRequired>办公地点</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入办公地点'">
              <input nz-input formControlName="officeLocation" placeholder="请输入办公地点" maxlength="255"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="majorDescription">专业简介</nz-form-label>
            <nz-form-control>
              <input nz-input formControlName="majorDescription" placeholder="请输入专业简介" maxlength="65535"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
    </form>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="primary" (click)="onSave()" [nzLoading]="saveLoading">保存</button>
      <button nz-button nzType="default" (click)="onReset()" [nzLoading]="saveLoading">重置</button>
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<faculty-selector (facultySelectedEvent)="handleFacultySelectedEvent($event)"></faculty-selector>
